<?php

use App\Http\Controllers\ChatController;
use App\Http\Controllers\CommonController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

//公共免费接口-----只限制次数
//Token验证中间件 ------------- checkJwt
//限流中间件 ------------- throttle 识别设备指定一分钟访问60次
Route::get('/', function () {
    echo "欢迎使用@just文接口!";
    echo "<br /> @just文QQ:1484772977";
    echo "<br /> @just文邮箱:1484772977@qq.com";
});

Route::middleware(['default_Throttle:60,1'])->group(function () {
    // 获取用户真实ip
    Route::get('/getip', [CommonController::class, 'getip']);
    // 网易云音乐
    Route::get('/wyyneran', [CommonController::class, 'wyyneran']);
    // 翻译
    Route::get('/trans', [CommonController::class, 'trans']);
    // 随机头像
    Route::get('/avatar', [CommonController::class, 'avatar']);
    //土味情话
    Route::get('/qinghua', [CommonController::class, 'qinghua']);
    //获取网站图标
    Route::get('/getfavicon', [CommonController::class, 'getfavicon']);
    //随机女仆
    Route::get('/nvpu', [CommonController::class, 'nvpu']);
    //二维码
    Route::get('/ewm', [CommonController::class, 'ewm']);
    //手机归属地
    Route::get('/getphone', [CommonController::class, 'getphone']);
    // 获取唯一标识id
    Route::get('/getuniqid', [CommonController::class, 'getuniqid']);
    // 获取验证码
    Route::get('/getyzm', [CommonController::class, 'getyzm']);
    // 校验验证码
    Route::get('/verifyzm', [CommonController::class, 'verifyzm']);
});

//用户管理
Route::middleware(['default_Throttle:60,1'])->group(function () {

    //获取数字验证码
    Route::get('getNumcode', [UserController::class, 'getNumcode']);
    //校验数字验证码
    Route::get('verifyNumcode', [UserController::class, 'verifyNumcode']);
    // 文件上传
    Route::post('UploadOneServlet', [UserController::class, 'UploadOneServlet']);
    // 验证token
    Route::get('verifyToken', [UserController::class, 'verifyToken']);
    // 发送邮箱
    Route::get('setEail', [UserController::class, 'setEail']);

    // 用户数据库操作
    Route::prefix('user')->group(function () {
        Route::get('login', [UserController::class, 'login']);
        Route::get('regster', [UserController::class, 'regster']);
        Route::get('info', [UserController::class, 'info']);
        Route::get('updete', [UserController::class, 'updete']);
        Route::get('select', [UserController::class, 'select']);
    });
});
//聊天服务
Route::middleware(['checkJwt', 'qbs_Throttle'])->group(function () {
    Route::prefix('chat')->group(function () {
        // 添加用户
        Route::get('/add', [ChatController::class, 'add']);
        //查找10个测试用户
        Route::get('/gettestuser', [ChatController::class, 'gettestuser']);
        // 用户上线
        Route::get('/goOnline', [ChatController::class, 'goOnline']);
        //用户下线
        Route::get('/outline', [ChatController::class, 'outline']);
        //发送消息
        Route::any('/sendmsg', [ChatController::class, 'sendmsg']);
        //阅读更新与别人的聊天记录
        Route::get('/updatecount', [ChatController::class, 'updatecount']);
        //查询AB聊天记录
        Route::get('/findABchat', [ChatController::class, 'findABchat']);
        //查询我的聊天列表
        Route::get('/findMsglist', [ChatController::class, 'findMsglist']);
        //撤回消息
        Route::get('/recallmsg', [ChatController::class, 'recallmsg']);
        //【实时刷新消息列表】
        Route::get('/findTimeMsglist', [ChatController::class, 'findTimeMsglist']);
        //【实时刷新聊天信息】
        Route::get('/findTimelist', [ChatController::class, 'findTimelist']);
     
     

    });

});
